
#if SANITIZER_LINUX

#if !defined(INCLUDED_FROM_INTERCEPTION_LIB)
# error "interception_linux.h should be included from interception library only"
#endif

#ifndef INTERCEPTION_LINUX_H
#define INTERCEPTION_LINUX_H

namespace __sanitizer {
bool InterceptFunction(const char *name, uptr *ptr_to_real, uptr func,
                       uptr wrapper);
// InterceptFunction for FREEBSD and NETBSD (with GLIBC support), see
// how to write the interfaces for other systems in LLVM
// bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real,
//                        uptr func, uptr wrapper);
}  // namespace __sanitizer

#define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) \
  ::__sanitizer::InterceptFunction(            \
      #func,                                      \
      (::__sanitizer::uptr *) & REAL(func),    \
      (::__sanitizer::uptr) & (func),          \
      (::__sanitizer::uptr) & WRAP(func))

#define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD_WITH_ADDR(func, func_addr) \
  ::__sanitizer::InterceptFunction(            \
      #func,                                      \
      (::__sanitizer::uptr *) & REAL(func),    \
      (::__sanitizer::uptr) (func_addr),          \
      (::__sanitizer::uptr) & WRAP(func))

#endif  // INTERCEPTION_LINUX_H
#endif  // SANITIZER_LINUX
